home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / keypres2.zip / KEYPRESS.DOC < prev   
Text File  |  1987-11-14  |  2KB  |  60 lines

  1. KEYPRESS
  2.  
  3. A utility to be used in batch files to intercept and use keystrokes.
  4. Note that the "IF ERROR LEVEL" statements must be in descending order,
  5. with Exit being the last (or zero error level).
  6.  
  7. This program was originally written by "lew w." (whoever that is).
  8. Regrettably, no further information on source or author is available.
  9.  
  10. I used ASMGEN to disassemble the original .COM file and commented the
  11. generated source .ASM file for your edification.  Also tweaked it
  12. a wee little bit.
  13.  
  14. DOKEY.BAT is my demo .BAT file to demonstrate KEYPRESS.  The original
  15. KEYPRESS.DOC (from "lew m.", below) is another demonstration.
  16.  
  17. You should be able to present menu choices from A to Z (and maybe even
  18. single numeric key entries as well).  Just be sure to get your error
  19. levels in the correct (reverse) order, and that the suggested key entries
  20. on your menu correspond to the results desired.
  21.  
  22. Naturally, as in any batch file, any legal DOS command can be produced from
  23. a single key stroke.  Using a multiple command interpreter, such as the
  24. public domain DO.COM, you could even send multiple commands to DOS.
  25. Watch it on nesting other .BAT files, however.  Strange and wondrous things
  26. can result.
  27.  
  28. David Kirschbaum
  29. Toad Hall
  30. kirsch@braggvax.ARPA
  31.  
  32. The original KEYPRESS.DOC follows:
  33.  
  34. THIS FILE IS USED IN BATCH FILES TO INTERCEPT AND UTILIZE KEYSTROKES 
  35. AN EXAMPLE BATCH FILE IS SHOWN BELOW
  36. NOTE THAT THE "IF ERROR LEVEL " STATEMENTS MUST BE IN DESCENDING ORDER
  37. WITH exit being the last, or zero error level
  38. good luck, lew w.
  39.  
  40. ECHO OFF
  41. :QUERY
  42. ECHO PRESS A OR B OR C
  43. ECHO A=1DIRPLUS
  44. ECHO B=PC-WRITE
  45. ECHO C=THIS FILE
  46. KEYPRESS A B C
  47. if errorlevel 3 goto c
  48. if errorlevel 2 goto b
  49. if errorlevel 1 goto a
  50. ECHO TRY AGAIN
  51. GOTO QUERY
  52. :a
  53. 1DIR
  54. :b
  55. CD\PCW
  56. ED
  57. :c
  58. GO
  59. :exit
  60.